import store from '@/store'

/**
 * @functionName addErrorLog
 * @param {Object} errorInfo 错误信息
 * @description 方法描述
 * @author 张航
 * @date 2020-05-18 16:44:13
 * @version V1.0.0
 */
export const addErrorLog = errorInfo => {
  const {
    statusText,
    status,
    config: {
      url,
      data,
      method
    }
  } = errorInfo
  console.log(errorInfo)
  const info = {
    type: 'ajax',
    code: status,
    mes: statusText,
    url,
    data,
    method
  }
  store.dispatch('addErrorLog', info)
}
